<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/loto_lb.css?time=02" rel="stylesheet" type="text/css">
<title>{Title}</title>
<script language="JavaScript">
<!--
	var MaxStakeMoney 	= {MaxStakeMoney};
	var MinStakeMoney 	= {MinStakeMoney};
	var CreditSurplus	= {CreditSurplus};
	var MaxStakePayOff	= {MaxStakePayOff};
	var JoinMixBet		= {JoinMixBet};
	var ChoiceGroupCounter	= {ChoiceGroup};
	var NewStakeMoney	= "";

	function check_num(num) {
		var i,j,strTemp,switchTemp;

		NewStakeMoney	= "";
		switchTemp 	= false;
		strTemp 	= "0123456789";

		if ( num.length == 0) {
			return false;
		}

		for (i = 0 ; i<num.length ; i++) {
			j = strTemp.indexOf(num.charAt(i));
			if (j != -1) {
				NewStakeMoney += num.charAt(i);
			} else {
				switchTemp = true;
			}
		}

		if (NewStakeMoney < MinStakeMoney) {
			NewStakeMoney = MinStakeMoney;
		}

		if (switchTemp) {
			return false; 
		}

		return true;
	}

	function ChkStakeMoney() {

		if (!JoinNumberCheckOut.StakeMoney.value) {
			window.StakeTotalMoney.innerHTML = "0";
			return;
		}

		if (!check_num(JoinNumberCheckOut.StakeMoney.value)) {
			window.alert('{Err_NumberErrorMessage}');
			JoinNumberCheckOut.StakeMoney.value = NewStakeMoney;
			JoinNumberCheckOut.StakeMoney.focus();
		}

		if (JoinNumberCheckOut.StakeMoney.value > MaxStakeMoney) {
			JoinNumberCheckOut.StakeMoney.value = "";//MaxStakeMoney;
			if (MaxStakeMoney == CreditSurplus) {
				window.alert("{Err_MaxStakeMoneyMessage}");
			} else if (MaxStakeMoney == MaxStakePayOff) {
				window.alert("{Err_MaxStakePayOffMessage}");
			} else if (MaxStakeMoney == JoinMixBet) {
				window.alert("{Err_JoinMixBetMessage}");
			}
			JoinNumberCheckOut.StakeMoney.focus();
		}
		window.StakeTotalMoney.innerHTML = ChoiceGroupCounter * JoinNumberCheckOut.StakeMoney.value;
	}
	
	function Chksubmit() {
		var TotalOrderMoney = JoinNumberCheckOut.StakeMoney.value * ChoiceGroupCounter;

		if (!check_num(JoinNumberCheckOut.StakeMoney.value)) {
			window.alert('{Err_NumberErrorMessage}');
			JoinNumberCheckOut.StakeMoney.value = MinStakeMoney;
			JoinNumberCheckOut.StakeMoney.focus();
			return false;
		}
		if (JoinNumberCheckOut.StakeMoney.value > MaxStakeMoney) {
			JoinNumberCheckOut.StakeMoney.value = "";//MaxStakeMoney;
			if (MaxStakeMoney == CreditSurplus) {
				window.alert("{Err_MaxStakeMoneyMessage}");
			} else if (MaxStakeMoney == MaxStakePayOff) {
				window.alert("{Err_MaxStakePayOffMessage}");
			} else if (MaxStakeMoney == JoinMixBet) {
				window.alert("{Err_JoinMixBetMessage}");
			}
			JoinNumberCheckOut.StakeMoney.focus();
			return false;
		} else if (JoinNumberCheckOut.StakeMoney.value < MinStakeMoney) {
			JoinNumberCheckOut.StakeMoney.value = MinStakeMoney;
			window.alert("{Err_MinStakeMoneyMessage}");
			JoinNumberCheckOut.StakeMoney.focus();
			return false;
		} else if (TotalOrderMoney > CreditSurplus) {
			//超過信用額度
			window.alert("{Err_CreditSurplusMessage}");
			JoinNumberCheckOut.StakeMoney.focus();
			return false;
		} else {
			parent.mainFrame.CleanCheckBoxAll();
			return true;
		}
	}
//-->
</script>
</head>

<body class="left_body" oncontextmenu="window.event.returnValue=false" ondragstart="window.event.returnValue=false" onselectstart="event.returnValue=false">
<form name="JoinNumberCheckOut" method="post" action="onjoinnumber_checkout.php" onsubmit="javascript: return Chksubmit()">
<input type="hidden" name="GambleID" value="{OrderGambleID}">
<input type="hidden" name="Bet_Type" value="{Bet_Type}">
<input type="hidden" name="Number" value="{Number}">
<input type="hidden" name="OddsID" value="{OrderOddsID}">
<input type="hidden" name="Odds" value="{OrderOdds}">
<input type="hidden" name="JoinNumber" value="{OrderStakeNumber}">
<input type="hidden" name="LottoID" value="{LottoID}">
<input type="hidden" name="UserID" value="{UserID}">
<input type="hidden" name="CheckKey1" value="{CheckKeyValue1}">
<input type="hidden" name="CheckKey2" value="{CheckKeyValue2}">
<input type="hidden" name="sid" value="{sid}">

<table border="0" cellpadding="0" cellspacing="0" class="left_jnc_out">
	<tr class="left_jnc_out_top">
		<td class="left_jnc_out_top">{Title}</td>
	</tr>
	<tr class="left_jnc_out_con">
		<td class="left_jnc_out_con">
			<table border="0" cellpadding="0" cellspacing="1" class="left_jnc_wg">
<!--使用者資訊//-->
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{MemberNameTitle}</td>
				<td class="left_jnc_wg_usercon">{Account}</td>
			</tr>
			<!--<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{CurrencyTitle}</td>
				<td class="left_jnc_wg_usercon">{Currency}</td>
			</tr>
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{CreditTitle}</td>
				<td class="left_jnc_wg_usercon">{CreditLine}</td>
			</tr>
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{CreditAlreadyUseTitle}</td>
				<td class="left_jnc_wg_usercon">{CreditAlreadyUse}</td>
			</tr>
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{CreditSurplusTitle}</td>
				<td class="left_jnc_wg_usercon">{CreditSurplus}</td>
			</tr>//-->
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{MinStakeTitle}</td>
				<td class="left_jnc_wg_usercon">{MinStakeMoney}</td>
			</tr>
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{MinWagerStakeTitle}</td>
				<td class="left_jnc_wg_usercon">{MinWagerStake}</td>
			</tr>
			<tr class="left_jnc_wg_user">
				<td class="left_jnc_wg_usertip">{MaxRoundLimitTitle}</td>
				<td class="left_jnc_wg_usercon">{MaxRoundLimit}</td>
			</tr>
<!--使用者資訊//-->
<!--特殊限額//-->{SpecialLimit}<!--特殊限額//-->
<!--下注種類//-->
			<tr class="left_jnc_wg_bet">
				<td colspan="2" class="left_jnc_wg_bettitle">{OddsListTitle}</td>
			</tr>
			<tr class="left_jnc_wg_bet">
			<td>{JoinOddsTitle}</td>
				<td align="left">{JoinOddsValue}</td>
			</tr>
<!--下注種類//-->
<!--下注內容//-->
			<tr class="left_jnc_wg_con">
				<td colspan="2" class="left_jnc_wg_contip">{OrderContentTitle}</td>
			</tr>
			<tr class="left_jnc_wg_con">
				<td colspan="2" class="left_jnc_wg_concon">{ChoiceNumberList}<br /><br />{JoinDocTitle}</td>
			</tr>
<!--下注內容//-->
<!--下注資訊//-->
			<tr class="left_jnc_wg_stake">
				<td class="left_jnc_wg_staketip">{PeriodsTitle}</td>
				<td class="left_jnc_wg_stakecon">{Periods}</td>
			</tr>
			<tr class="left_jnc_wg_stake">
				<td class="left_jnc_wg_staketip">{MaxPayOffTitle}</td>
				<td class="left_jnc_wg_stakecon">{MaxPayOff}</td>
			</tr>
			<tr class="left_jnc_wg_stake">
				<td class="left_jnc_wg_staketip">{StakeMoneyTitle}</td>
				<td class="left_jnc_wg_stakecon"><input name="StakeMoney" type="text" maxlength="15" onKeyup="javascript:ChkStakeMoney()" class="left_jnc_wg_stakecon"></td>
			</tr>
			<tr class="left_jnc_wg_stake">
				<td class="left_jnc_wg_staketip">{StakeTotalMoneyTitle}</td>
				<td class="left_jnc_wg_stakecon"><span id="StakeTotalMoney" class="left_jnc_wg_stakecon"></span></td>
			</tr>
<!--下注資訊//-->
<!--下注按鈕//-->
			<tr class="left_jnc_wg_button">
				<td colspan="2" class="left_jnc_wg_button">
					<input type="button" class="left_jnc_wg_reset" name="Reset" value="{Cancel}" onclick="javascript:location.href='account.php'">&nbsp;
					<input type="submit" class="left_jnc_wg_submit" name="Submit" value="{Submit}">
				</td>
			</tr>
<!--下注按鈕//-->
			</table>
		</td>
	</tr>
	<tr class="left_jnc_out_bottom">
		<td class="left_jnc_out_bottom"></td>
	</tr>
</table>
</form>
</body>

<script language="javascript">
<!--
	if (MaxStakeMoney < MinStakeMoney) {
		JoinNumberCheckOut.StakeMoney.disabled = true;
		JoinNumberCheckOut.Submit.disabled = true;
		JoinNumberCheckOut.Reset.disabled = true;
		JoinNumberCheckOut.StakeMoney.value = 0;
		window.alert("{Err_MaxStakeMoneyOverMixMessage}");
	} else {
		JoinNumberCheckOut.StakeMoney.focus();
		//JoinNumberCheckOut.StakeMoney.value = MinStakeMoney;
	}

	window.StakeTotalMoney.innerHTML = ChoiceGroupCounter * JoinNumberCheckOut.StakeMoney.value;

//-->
</script>
</html>